#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: fast_async_demo.py 
@version:
@time: 2023/02/18 
"""
from typing import Union

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str, None] = None):
    return {"item_id": item_id, "q": q}

# Note:
#
# 如果你不知道是否会用到，可以查看文档的 "In a hurry?" 章节中 关于 async 和 await 的部分。